package life.cqq.jwt.config;

import life.cqq.jwt.interceptor.AutoInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    private final AutoInterceptor autoInterceptor;

    public WebConfig(AutoInterceptor autoInterceptor) {
        this.autoInterceptor = autoInterceptor;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(autoInterceptor).addPathPatterns("/**").excludePathPatterns("/getToken");
    }
}